package design.pattern.structural.composite;

import java.util.ArrayList;
import java.util.List;

public class Plate {
    private final List<Fruit> fruits;

    public Plate() {
        fruits = new ArrayList<Fruit>();
    }

    public Plate(List<Fruit> fruits) {
        this.fruits = fruits;
    }

    public void eat() {
        fruits.remove(0).eat();
    }

    public void add(Fruit fruit) {
        this.fruits.add(fruit);
    }

    public void remove(Fruit fruit) {
        this.fruits.remove(fruit);
    }
}
